let mySwiper = new Swiper('.swiper', {
    spaceBetween: 30,
    centeredSlides: true,
    autoplay: {
        delay: 2500,
        disableOnInteraction: false,
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
    },
    loop: true


});
$('.swiper').addEventListener('mouseover', function() {
    mySwiper.autoplay.stop();
    $('.swiper-button-prev').style.display = 'block'
    $('.swiper-button-next').style.display = 'block'

})
$('.swiper').addEventListener('mouseout', function() {
        mySwiper.autoplay.start();
        $('.swiper-button-prev').style.display = 'none'
        $('.swiper-button-next').style.display = 'none'

    })
    //遍历出所有li标签
let pathname = '';
$a('.ul2 li a').forEach(function(v) {
        //v代表每一个li标签   注册鼠标移入时间
        v.addEventListener('mouseover', function() {
            //鼠标移入更换背景颜色
            v.style.backgroundColor = '#1271ef'
                //这是获取a标签下面第一个儿子的src元素
            let path = v.children[0].src
                //这是截取路径
            let index1 = path.lastIndexOf('/')
            let index2 = path.lastIndexOf('.')
                //截取路径添加
            pathname = path.slice(index1 + 1, index2)
            v.children[0].src = `../../assets/imgs/${pathname}-c.svg`

        })
        v.addEventListener('mouseout', function() {
            //鼠标移出背景颜色为空
            v.style.backgroundColor = ''
            v.children[0].src = `../../assets/imgs/${pathname}.svg`

        })


    })
    //回到顶部
function a() {
    //   console.log(1); //打印测试
    scrollTo({
        left: 0,
        top: 0,
        behavior: 'smooth'
    })
}
window.addEventListener('scroll', function() {
        if (window.scrollY >= 700) {
            $('.box').classList.add('blk')
        } else {
            $('.box').classList.remove('blk')
        }
    })
    //行业巨头

let index = 0;
setInterval(function() {
    //删除类名
    //第一张本身就是不透明，删除不透明元素，间隔3秒过后添加不透明元素
    $a('.industry1')[index].classList.remove('opy1')

    ++index;

    if (index >= $a('.industry1').length) {
        index = 0;
    }
    $a('.industry1')[index].classList.add('opy1')

}, 3000)